

#include <stdio.h>

int isprime(int n);
int splitsum(int n);
int splitsqu(int n);
int main(){
    int n;
    for(n=100;n<=9999;n++)
        if(isprime(n)==1&&splitsqu(n)==1&&splitsum(n)==1)
            printf("%d is prime\n",n);
    return 0;
        
}
int isprime(int n)
{
    int i;
    for(i=2;i<n;i++)
        if(n%i==0)
            break;
if (i==n)
return 1;
return 0;
}
int splitsum(int n)
{
    int sum=0;
    while (n!=0) {
        sum+=n%10;
        n=n/10;
    }
        return sum;
}
    int splitsqu(int n)
    {
    int squ=0;
    while (n!=0) {
        squ+=(n%10)*(n%10);
        n=n/10;
    }
        return squ;

    }
